Update copyright year with a precommit hook#1514
Merged
mdboom merged 4 commits intoNVIDIA:mainfrom Jan 21, 2026
Merged
Conversation
Contributor
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
kkraus14
approved these changes
Jan 20, 2026
66423a9 to
a3f5c7c
Compare
Contributor
Author
|
/ok to test |
This comment has been minimized.
This comment has been minimized.
kkraus14
approved these changes
Jan 20, 2026
rwgk
approved these changes
Jan 21, 2026
Collaborator
rwgk
left a comment
There was a problem hiding this comment.
Minor (and very easy) suggestion to catch typos.
| years = match.group("years").decode() | ||
| if "-" in years: | ||
| start_year, end_year = years.split("-", 1) | ||
| if int(start_year) > int(end_year): |
Collaborator
There was a problem hiding this comment.
To catch typos, WDYT about adding
or int(end_year) > int(CURRENT_YEAR)
here?
I'd probably make this
if int(start_year) >= int(end_year) or int(end_year) > int(CURRENT_YEAR):
to catch things like 2026-2026 as well (when someone maybe wanted to write 2025-2026 but got mixed up).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is hard to remember that the copyright year should be updated when there are changes to files. This modifies our existing SPDX pre-commit hook to fix the latest copyright year.
Locally, the pre-commit hook only runs on modified files, and we explicitly do not want to do a mass update of every file, especially ones that haven't changed in a while.
HOWEVER, since the pre-commit CI check runs on every file, it does require that every file is compliant with the rule, which is why there is an update of many files here. It shows how many files we have forgotten to update in the past -- but once we do this mass update we should never have to do another one going forward since this rule will help us remember.
EDIT: There is actually a really hilarious cyclical problem with doing it that way. You can ask it to update the copyright years based on the last known commit. But that creates a commit in this year, so it will immediately want to update to this year. I don't think that's the behavior we want, so I've modified this to only check the last year on /staged/ files. It means the year check doesn't actually run as part of CI, but I think that's fine. And it means no mass updating of files at this time -- just correctness going forward as things get naturally updated.